package com.itheima.dao;

import com.itheima.pojo.Contact;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author slstart
 * @create 2021-05-23 19:23
 */
public interface ContactDao {
    @Select("select * from contact")
    List<Contact> findAll();

    @Insert("insert into contact values(null,#{name},#{sex},#{age},#{address},#{qq},#{email})")
    int add(Contact contact);

    @Select("select * from contact where id = #{id}")
    Contact findById(String id);

    @Update("update contact set name=#{name},sex=#{sex},age=#{age},address=#{address},qq=#{qq},email=#{email} where id = #{id}")
    int updateContact(Contact contact);

    @Delete("delete from contact where id = #{id}")
    int deleteContactById(String id);
}
